package com.uuah.server.context.notification;

import javax.management.ObjectName;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AgentMBeanNotification extends ServerNotification {

	private static final long serialVersionUID = 2344343265981811120L;
	private transient Logger logger = LoggerFactory
			.getLogger(AgentMBeanNotification.class);
	public static final int CREATE_MBEAN_ACTION = AGENT_EVENT_ACTION_START_RANGE + 1;
	public static final int DELETE_MBEAN_ACTION = AGENT_EVENT_ACTION_START_RANGE + 2;
	static {
		registerAction("create mbean", CREATE_MBEAN_ACTION);
		registerAction("delete mbean", DELETE_MBEAN_ACTION);
	}
	private Object mbeanObj;
	private ObjectName objectName;
	private boolean dynamic = false;

	public boolean isDynamic() {
		return dynamic;
	}

	public Object getMbeanObj() {
		return mbeanObj;
	}

	public String toString() {
		return EVENT_NAME + "{action=" + getActionName(action) + ", mbeanObj: "
				+ mbeanObj + ", objectName=" + objectName + ",dynamic="
				+ dynamic + ", timestamp=" + timestamp + ", message: " + source
				+ "}";
	}

	public ObjectName getObjectName() {
		return objectName;
	}

	public AgentMBeanNotification(Object mbeanObj, ObjectName objectName,
			int action) {
		super(mbeanObj, action);
		this.mbeanObj = mbeanObj;
		this.objectName = objectName;
	}

	public AgentMBeanNotification(Object mbeanObj, ObjectName objectName,
			boolean inLifecycleManage, int action) {
		super(mbeanObj, action);
		this.mbeanObj = mbeanObj;
		this.objectName = objectName;
		this.dynamic = inLifecycleManage;
	}
}
